﻿using System.Collections.Generic;
using System.Linq;

namespace StudyEnglish.Application.Filter
{
    public abstract class BaseFilterCategory
    {
        /// <summary>
        /// Key, that identificates category. Required to the building URL
        /// </summary>
        public int Key;

        /// <summary>
        /// Category name. Is shown on the page
        /// </summary>
        public string Name;
        
        public abstract IList<BaseFilterItem> Items { get; }

        public BaseFilterCategory()
        {
            
        }

        public BaseFilterCategory(string name)
        {
            Name = name;
        }


        public IList<BaseFilterItem> SelectedItems
        {
            get { return (from x in Items where x.IsSelected == true select (BaseFilterItem)x).ToList(); }
        }

        /// <summary>
        /// returns list of item that weren't selected
        /// </summary>
        public IList<BaseFilterItem> NotSelectedItems
        {
            get { return (from x in Items where x.IsSelected == false select x).ToList(); }
        }
    }
}